package com.duangxt.utils;

/**
 * @Author: duangxt
 * @Title:
 * @ClassName: GeneralUtils.java
 * @Description:
 * @Date: Create in 2020/7/6 16:16:51
 * @Version: V0.0.1
 */
public class GeneralUtils {

    //符号
    /** \\. 转义小数点：正则表达式 */
    public final static String DOT = "\\.";

    /** 小数点 */
    public static final String POINT = ".";

    /** , 英文半角逗号 */
    public final static String COMMA = ",";

    /** = 英文半角 等于  符号 */
    public static final String QSTRING_EQUAL = "=";
    /** & 英文半角 与 符号 */
    public static final String QSTRING_SPLIT = "&";
    /** ; */
    public static final String QSTRING_SEMICOLON = ";";

    /** # */
    public static final String QSTRING_POUND = "#";

    /** : */
    public static final String QSTRING_COLON = ":";


    // 文件后缀名
    public static final String xml = "xml";
    public static final String OFFICE_EXCEL_2003_POSTFIX = "xls";
    public static final String OFFICE_EXCEL_2010_POSTFIX = "xlsx";


    // Http请求
    public static final String GET = "GET";
    public static final String POST = "POST";
    public static final String PUT = "PUT";
    public static final String Accept = "Accept";
    public static final String Connection = "Connection";
    public static final String User_Agent = "User-Agent";
    public static final String Content_Type = "Content-Type";


    // 关键字单词
    /** 小写签名串 sign */
    public final static String SIGN = "sign";
    /** 小写签名串 signature */
    public final static String SIGNATURE = "signature";
    /** 小写签名方类型 sign_type */
    public final static String SIGN_TYPE = "sign_type";
    public final static String time = "time";

    public static final String TRUE_STR = "TRUE";
    public static final String FALSE_STR = "FALSE";
    public static final String trueStr = TRUE_STR.toLowerCase();
    public static final String falseStr = FALSE_STR.toLowerCase();

    // 返回内容字符串
    public static final String RESULT = "RESULT";
    public static final String result = RESULT.toLowerCase();
    public static final String SUCCESS = "SUCCESS";
    public static final String success = SUCCESS.toLowerCase();
    public static final String OK = "OK";
    public static final String ok = OK.toLowerCase();
    public final static String FAILURE = "FAILURE";
    public static final String FAILED = "FAILED";
    public static final String FAIL = "FAIL";
    public static final String fail = FAIL.toLowerCase();

    // 编码
    public static final String UTF8 = "UTF-8";
    public static final String UTF_8 = UTF8;
    public static final String UTF_16 = "UTF-16";
    public static final String GBK = "GBK";
    public static final String ISO_8859_1 = "ISO-8859-1";

    public static final String DEFAULT_ENCODING = UTF8;

    public static final String HmacMD5 = "HmacMD5";
    public static final String MD5 = "MD5";
    public static final String SHA1 = "SHA1";
    public static final String SHA256 = "SHA256";

    // 不常用编码
    public static final String UTF_16LE = "UTF-16LE";
    public static final String UTF_16BE = "UTF-16BE";
    public static final String US_ASCII = "US-ASCII";

    // 正则表达式
    private static final String china_mobile_regex_2017 = "^(((13[0-9])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8})|(0\\d{2}-\\d{8})|(0\\d{3}-\\d{7})$";
    private static final String china_mobile_regex_2019 = "^[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$";

    public static final String CHINA_MOBILE_REGEX = china_mobile_regex_2019;

    public static final String EMAIL_REGEX = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";

    public static final String IPV4_REGEX = "^((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]|[*])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]|[*])$";

    public static final String IPV6_REGEX = "^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]" +
            "\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]" +
            "\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})" +
            "?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|" +
            "((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:" +
            "[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|((" +
            "[0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|" +
            "[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|" +
            "[1-9]?\\d)){3}))|:)))(%.+)?\\s*$";


    /** 日志分隔线 */
    public static final String SEPARATOR_LINE =
            "--------------------------------------------------------------------------------------------------------------";
}
